class Solution:
    def jump(self, nums: list) -> int:
        if len(nums) <= 1:
            return 0
        cur = 0
        step = 0
        while cur < len(nums):
            if cur + nums[cur] >= len(nums) - 1:
                step += 1
                break
            step_length = 0
            next_pos = cur
            for i in range(1, nums[cur] + 1):
                if step_length <= nums[cur + i] + i:
                    next_pos = cur + i
                    step_length = nums[cur + i] + i

            cur = next_pos
            step += 1

        return step
